package com.jack.jetpackapp

/**
 * 请描述使用该类使用方法！！！
 *
 * @author Jack 2021-06-17 23:28
 */
class Ticket : Runnable {
    private var ticket = 1000
    private val obj = Any()

    override fun run() {
        synchronized(obj) {
            while (ticket > 0) {
                Thread.sleep(20)
                println(Thread.currentThread().name + "还有余票数：" + ticket--)
            }
        }
    }
}